import multiprocessing

# 添加用户设置
user = 'www'
group = 'www'

# 监听地址和端口
bind = '0.0.0.0:8003'

# 根据宝塔面板设置调整进程数
workers = 4
threads = 2

# 使用 uvicorn worker
worker_class = 'uvicorn.workers.UvicornWorker'

# 超时设置 - 增加超时时间
timeout = 300
graceful_timeout = 300
keepalive = 5

# 访问日志和错误日志
accesslog = '/www/wwwroot/TravelAgentAPI/logs/access_8003.log'
errorlog = '/www/wwwroot/TravelAgentAPI/logs/error_8003.log'
loglevel = 'info'  # 改回 info 级别，减少日志量

# 后台运行
daemon = True

# 进程文件
pidfile = '/www/wwwroot/TravelAgentAPI/run/gunicorn_8003.pid'

# 最大并发请求数
worker_connections = 1000

# 预加载应用
preload_app = True

# 工作目录
chdir = '/www/wwwroot/TravelAgentAPI'

# 重启策略
max_requests = 1000
max_requests_jitter = 50

# 允许的客户端IP
forwarded_allow_ips = '*'

# 添加调试信息
capture_output = True
enable_stdio_inheritance = True 